import multiprocessing
import os

# 函数
def run_th(name, id):
    print('Child process {0} {1} Running '.format(name, os.getpid()),id)

# 主程序
if __name__ == '__main__':
    print('Parent process {0} is Running'.format(os.getpid()))
    for i in range(5):
        p = multiprocessing.Process(target=run_th, args=(str(i), "1111"))
        p.start()
    # 方法实现进程间的同步，等待所有进程退出。
    # p.join()
    while len(multiprocessing.active_children()) != 0:
        pass
    print('Process close')
